﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Common.Forms
{
    public enum PorukaVrsta
    {
        Informacija = 1,
        Upozorenje,
        Greska
    }

    public enum PorukaDugmic
    {
        Ok = 1,
        Da,
        Ne,
        Odustani
    }

    public partial class Poruka : Form
    {
        public static DialogResult PrikaziPoruku(PorukaVrsta vrstaPoruke, string tekstPoruke, PorukaDugmic[] dugmici)
        {
            Poruka p = new Poruka(vrstaPoruke, tekstPoruke, dugmici);
            p.ShowDialog();
            return p.DialogResult;
        }

        protected Poruka(PorukaVrsta vrstaPoruke, string tekstPoruke, PorukaDugmic[] dugmici)
        {
            InitializeComponent();

            switch (vrstaPoruke) {
                case PorukaVrsta.Upozorenje:
                    imgBox.Image = global::Common.Properties.Resources.msg_warning;
                    this.Text = "Upozorenje";
                    break;
                case PorukaVrsta.Greska:
                    imgBox.Image = global::Common.Properties.Resources.msg_warning;
                    this.Text = "Greška";
                    break;
                default:
                    imgBox.Image = global::Common.Properties.Resources.msg_info;
                    this.Text = "Informacija";
                    break;
            }

            for (int i = 0; i < dugmici.Length; i++)
            {
                switch (dugmici[i])
                {
                    case PorukaDugmic.Da:
                        btnPositive.Text = "&Da";
                        btnPositive.Visible = true;
                        break;
                    case PorukaDugmic.Ne:
                        btnNegative.Text = "&Ne";
                        btnNegative.Visible = true;
                        break;
                    case PorukaDugmic.Ok:
                        btnPositive.Text = "&OK";
                        btnPositive.Visible = true;
                        btnPositive.Location = new Point(318, 95);
                        break;
                    case PorukaDugmic.Odustani:
                        btnNegative.Text = "O&dustani";
                        btnNegative.Visible = true;
                        break;
                }
            }

            lblPoruka.Text = tekstPoruke;
        }
    }
}
